<?php
namespace App\Http\Controllers\Api;

use App\Model\City;
use App\Model\Province;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class AreaController extends Controller
{
    public function getProvinces()
    {
        $provinces = Province::pluck('name', 'id')->toArray();
        return response()->json($provinces);
    }

    public function getCityList(Request $request)
    {
        $res = City::where('pid', $request->input('pid'))->get();
        return response()->json($res);
    }
}